how to find all the numbers below 100 which ara divided by 7.
C# Program to find all the divisible numbers by 7 which are Less than 100
53214-Feb-2023
Home / DeveloperSection / Forums / C# Program to find all the divisible numbers by 7 which are Less than 100
Aryan Kumar
15-Jun-2023Sure, here is a C# program to find all the divisible numbers by 7 which are less than 100:
C#
This program uses a for loop to iterate through the numbers 1 to 99. It then uses the modulus operator (%) to check if each number is divisible by 7. If the number is divisible by 7, it is printed to the console. When you run this program, it will output all the divisible numbers by 7 which are less than 100.
Here is an example of how the program would work:
Code snippet
Sanjay Goenka
06-Apr-2023Sure, here is an example C# program that finds all the divisible numbers by 7 which are less than 100:
arduinoCopy code
This program uses a for loop to iterate through the numbers 1 to 99 and checks if each number is divisible by 7 using the modulus operator (%). If the number is divisible by 7, it is printed to the console.
When you run this program, it will output all the divisible numbers by 7 which are less than 100.
Gaurika C
06-Apr-2023The following code can be employed to get multiples of 7 lesser than 100. The % operator gives the remainder for 2 values. The logic depicts that if the remainder is 0, that means the number is completely divisible by 7. The for loop continues to be executed till the number is greater than 1 and lesser than 100. Note that the sign is not <= which depicts that 100 is not included in the range of numbers to be verified for divisibility. i++ refers to an increment in the value of the number to be checked for division with 7.
Using System;
class Program
{
static void Main(string[ ] args)
{
for (int i = 1; i < 100; i++)
{
if (i % 7 == 0)
{
Console.WriteLine(i);
}
}
}
}
The output of the code would be 7, 14, 21, 28, 35, 42, 49, 56, 63, 70, 77, 84, 91, 98
Ashutosh Patel
15-Feb-2023This is the C# program to find divisible numbers of any specific number below 100,